<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<#include "/jspgou_sys/head.html"/>
<script type="text/javascript">
function optDelete() {
	if(Pn.checkedCount('ids')<=0) {
		alert("<@s.m 'error.checkRecord'/>");
		return;
	}
	if(!confirm("<@s.m 'global.confirm.delete'/>")) {
		return;
	}
	var f = document.getElementById('tableForm');
	f.action="o_delete.do";
	f.submit();
}

function getTableForm(){
	return document.getElementById("tableForm");
}
function optTuijian() {
	if(Pn.checkedCount('ids')<=0) {
		alert("<@s.m 'error.checkRecord'/>");
		return;
	}
	if(!confirm("确定要推荐这些商品?")) {
		return;
	}
	var f = document.getElementById('tableForm');
	f.action="v_tuijian.do";
	f.submit();
}

  function optShangjia(){
	  if(Pn.checkedCount('ids')<=0){
		  alert("<@s.m 'error.checkRecord'/>");
		  return;
	  }
	  if(!confirm("确定要上架?")) {
			return;
	  }
	  var f=document.getElementById('tableForm');
	  f.action="v_shangjia.do";
	  f.submit();
  }
  function optXiajia(){
	  if(Pn.checkedCount('ids')<=0){
		  alert("<@s.m 'error.checkRecord'/>");
		  return;
	  }
	  if(!confirm("确定要下架?")) {
			return;
	  }
	  var f=document.getElementById('tableForm');
	  f.action="v_xiajia.do";
	  f.submit();
  }




function optProhibit(){
	if(Pn.checkedCount('ids')<=0) {
		alert("<@s.m 'error.checkRecord'/>");
		return;
	}
	if(!confirm("确定要批量禁售这些商品?")) {
		return;
	}
	var f = document.getElementById('tableForm');
	f.action="v_pacthProhibit.do";
	f.submit();
	
}

function optNoProhibit(){
	if(Pn.checkedCount('ids')<=0) {
		alert("<@s.m 'error.checkRecord'/>");
		return;
	}
	if(!confirm("确定要批量取消禁售这些商品?")) {
		return;
	}
	var f = document.getElementById('tableForm');
	f.action="v_pacthNotProhibit.do";
	f.submit();
	
}

function optstockCount(){
	var f = document.getElementById('tableForm');
	f.action="o_stockCount.do";
	f.submit();
}
function optsalePrice(){
	var f = document.getElementById('tableForm');
	f.action="o_salePrice.do";
	f.submit();
}
</script>
</head>
<body>
<div class="body-box">
<div class="rhead">
	<div class="rpos"><@s.m "global.position"/>: <@s.m "shop.function.product"/> - <@s.m "product.function"/> - <@s.m "global.list"/></div>
	<form class="ropt">
		<#if category??>
		<input type="hidden" name="ctgId" value="${category.id}"/>
		<input type="submit" value="<@s.m "global.add"/>" onclick="this.form.action='v_add.do';"/>
		<#else>
		<div style="padding:5px 0 0 0"><@s.m "product.selectCategory"/></div>
		</#if>
	</form>
	<div class="clear"></div>
</div>
<div class="rhead">
	<form action="v_list.do">
	 <select name="typeId">
            <option value="">--商品分类--</option>
         <#list typeList as productType>
            <option value="${productType.id}"<#if typeId??> <#if typeId==productType.id>selected="selected"</#if></#if>>${productType.name!}</option>
         </#list>  
       </select>
	<@s.m "product.name"/>:<input type="text" name="productName" value="${productName!}" style="width:100px"/>
	品牌名称: <input type="text" name="brandName" value="${brandName!}" style="width:100px"/>
	<select name="source">
            <option value="">--商品来源--</option>
            <option value="0" <#if source??> <#if source==0>selected="selected"</#if></#if>>平台商自营</option>
            <option value="1" <#if source??> <#if source==1>selected="selected"</#if></#if>>第三方店铺商品</option> 
    </select>
    <select name="Ontheshelf">
            <option value="">--上/下架--</option>
            <option value="true" <#if Ontheshelf??> <#if Ontheshelf==true>selected="selected"</#if></#if>>上架</option>
            <option value="false" <#if Ontheshelf??> <#if Ontheshelf==false>selected="selected"</#if></#if>>下架</option> 
    </select> 
    <select name="Whetherban">
            <option value="">--禁/非(禁售)--</option>
            <option value="false" <#if Whetherban??> <#if Whetherban==false>selected="selected"</#if></#if>>禁售</option>
            <option value="true" <#if Whetherban??> <#if Whetherban==true>selected="selected"</#if></#if>>非禁售</option> 
    </select>
    <select name="Whetherpresale">
            <option value="">--预/非预(售)--</option>
            <option value="true" <#if Whetherpresale??> <#if Whetherpresale==true>selected="selected"</#if></#if>>预售</option>
            <option value="false" <#if Whetherpresale??> <#if Whetherpresale==false>selected="selected"</#if></#if>>非预售</option> 
    </select> 
	  库存:
	    <input type="text" name="startStock" value="${startStock!}" style="width:50px"/>
	    &nbsp;至&nbsp;<input type="text" name="endStock" value="${endStock!}" style="width:50px"/>
		<input type="submit"  class="ropt" value="<@s.m "global.query"/>" />
	</form>
	<div class="clear"></div>	
</div>

<div><a href="../noctice/v_list.do"><input type="button" value="到货通知"></a>&nbsp;
<a href="../consumertop/v_list.do"><input type="button" value="消费排行"/></a>&nbsp;
<a href="../salesstatistic/v_list.do"><input type="button" value="销售统计"></a>
</div>
<form id="tableForm" method="post">
<input type="hidden" name="typeId" value="${typeId!}"/>
<input type="hidden" name="source" value="${source!}"/>
<input type="hidden" name="Ontheshelf" value="<#if Ontheshelf??>${Ontheshelf?string('true','false')}<#else>${Ontheshelf!}</#if>"/>
<input type="hidden" name="Whetherban" value="<#if Whetherban??>${Whetherban?string('true','false')}<#else>${Whetherban!}</#if>"/>
<input type="hidden" name="Whetherpresale" value="<#if Whetherpresale??>${Whetherpresale?string('true','false')}<#else>${Whetherpresale!}</#if>"/>
<input type="hidden" name="startStock" value="${startStock!}"/>
<input type="hidden" name="endStock" value="${endStock!}"/>
<input type="hidden" name="productName" value="${productName!}"/>
<input type="hidden" name="brandName" value="${brandName!}"/>
<input type="hidden" name="pageNo" value="${pageNo!}"/>
<input type="hidden" name="ctgId" value="${ctgId!}"/>
<@p.table value=pagination;product,i,has_next><#rt/>
	<@p.column title="<input type='checkbox' onclick='Pn.checkbox(\"ids\",this.checked)'/>" width="20">
		<input type='checkbox' name='ids' value='${product.id}'/><#t/>
	</@p.column><#t/>
	<@p.column title="ID" width="20">${product.id!}</@p.column><#t/>
	<@p.column code="product.name" align="center"><a href="${product.url}" target="_blank">${product.name}</a></@p.column><#t/>
	<@p.column code="product.category" align="center">${product.category.name}</@p.column><#t/>
	<@p.column code="product.type" align="center">${product.type.name}</@p.column><#t/>
	<@p.column code="自营" align="center"><#if product.store??>否<#else>是</#if></@p.column><#t/>
	<!-- <@p.column code="product.salePrice" align="center">
		<input type="text" name="salePrice_${product.id}" size="5" value="<#if product.productFashion??>${product.productFashion.salePrice!}<#else>${product.salePrice!}</#if>" />
		<input type="hidden" name="spwids" value="${product.id}"/>
		</@p.column><#t/> -->
	<@p.column code="product.stockCount" align="center">
		${product.stockCount}
		<!-- <input type="hidden" name="scwids" value="${product.id}"/> -->
	</@p.column><#t/>
	<@p.column code="product.brand" align="center"><#if product.brand??>${(product.brand.name)!}</#if></@p.column><#t/>	
	<@p.column code="上/下架" align="center">
	<#if product.onSale>
	<a href="a_update.do?id=${product.id}&pageNo=${pageNo!}&ctgId==${(product.category.id)!}" >
	<div>下架</div></a>
	<#else>
	 <a href="a_update.do?id=${product.id}&pageNo=${pageNo!}&ctgId==${(product.category.id)!}"><div>上架</div></a>
	 </#if></@p.column><#t/>
	<@p.column code="禁售" align="center">
	    <#if product.prohibit??>
	    	<#if product.prohibit>
	    		<a href="o_prohibit.do?id=${product.id}&pageNo=${pageNo!}&ctgId=${(product.category.id)!}"><@s.m "product.prohibit"/></a> 
		    <#else>
		    	<a href="o_prohibit.do?id=${product.id}&pageNo=${pageNo!}&ctgId=${(product.category.id)!}"><@s.m "product.notProhibit"/></a> 
		    </#if>
		 <#else>
		 <a href="o_prohibit.do?id=${product.id}&pageNo=${pageNo!}&ctgId=${(product.category.id)!}"><@s.m "product.prohibit"/></a> 
		 </#if>
	</@p.column><#t/>	
	<@p.column code="product.yushou" align="center"><#if product.yushou??><#if product.yushou><@s.m "global.true"/><#else><@s.m "global.false"/></#if></#if></@p.column><#t/>
	<@p.column code="global.operate" align="center">
		<a href="v_edit.do?id=${product.id}&pageNo=${pageNo!}&ctgId=${(product.category.id)!}"><@s.m "global.edit"/></a> | <#rt/>
		<a href="o_delete.do?ids=${product.id}&pageNo=${pageNo!}&ctgId=${(product.category.id)!}" onclick="if(!confirm('<@s.m "global.confirm.delete"/>')) {return false;}"><@s.m "global.delete"/></a><#t/>
	</@p.column><#t/>
</@p.table>

<div>
	<input type="button" value="<@s.m "global.delete"/>" onclick="optDelete();"/> 
	<input type="button" value="推荐" onclick="optTuijian();"/>
 	<input type="button" value="上架" onclick="optShangjia();"> 
 	<input type="button" value="下架" onclick="optXiajia();">
 	<input type="button" value="批量禁售" onclick="optProhibit();"/>
 	<input type="button" value="批量取消禁售" onclick="optNoProhibit();"/>
 	<!-- <input type="button" value="保存库存" onclick="optstockCount();">
 	<input type="button" value="保存售价" onclick="optsalePrice();"> -->
 </div>

</form>
</div>
<#include "/common/alert_message.html"/>
</body>
</html>